/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.pucp.dp1.TSPSolution.view;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;

/**
 *
 * @author walter
 */
public class Frm_RegistrarCliente extends javax.swing.JPanel {

    /**
     * Creates new form Frm_RegistrarCliente
     */
    public Frm_RegistrarCliente() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton3 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        lblNombre = new javax.swing.JLabel();
        lblApellido = new javax.swing.JLabel();
        lblDocIdentidad = new javax.swing.JLabel();
        lblTelefono = new javax.swing.JLabel();
        lblCorreo = new javax.swing.JLabel();
        txtNombres = new javax.swing.JTextField();
        txtApellidos = new javax.swing.JTextField();
        txtDocIdentidad = new javax.swing.JTextField();
        txtTelefono = new javax.swing.JTextField();
        txtCorreo = new javax.swing.JTextField();
        btnRegistrarCliente = new javax.swing.JButton();
        btnCancelarRegCliente = new javax.swing.JButton();
        btnLimpiarRegCliente = new javax.swing.JButton();

        jButton3.setText("jButton3");

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Registrar Cliente"));

        lblNombre.setText("Nombres");

        lblApellido.setText("Apellidos");

        lblDocIdentidad.setText("Doc. Identidad");

        lblTelefono.setText("Teléfono");

        lblCorreo.setText("Correo Electrónico");

        btnRegistrarCliente.setText("Registrar");
        btnRegistrarCliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                btnRegistrarClienteMouseReleased(evt);
            }
        });

        btnCancelarRegCliente.setText("Cancelar");
        btnCancelarRegCliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                btnCancelarRegClienteMouseReleased(evt);
            }
        });

        btnLimpiarRegCliente.setText("Limpiar");
        btnLimpiarRegCliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                btnLimpiarRegClienteMouseReleased(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(lblTelefono)
                            .add(lblCorreo)
                            .add(lblNombre)
                            .add(lblApellido)
                            .add(lblDocIdentidad)))
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(56, 56, 56)
                        .add(btnRegistrarCliente)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 24, Short.MAX_VALUE)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(btnLimpiarRegCliente)
                        .add(29, 29, 29)
                        .add(btnCancelarRegCliente))
                    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(txtTelefono, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, txtDocIdentidad)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, txtApellidos)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, txtNombres)
                        .add(txtCorreo)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                            .add(org.jdesktop.layout.GroupLayout.TRAILING, lblNombre)
                                            .add(org.jdesktop.layout.GroupLayout.TRAILING, txtNombres, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                        .add(18, 18, 18)
                                        .add(lblApellido))
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, txtApellidos, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(18, 18, 18)
                                .add(lblDocIdentidad))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, txtDocIdentidad, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(18, 18, 18)
                        .add(lblTelefono))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, txtTelefono, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(txtCorreo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(lblCorreo))
                .add(18, 18, 18)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btnRegistrarCliente)
                    .add(btnCancelarRegCliente)
                    .add(btnLimpiarRegCliente))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(13, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void registrar( String nombre , String apellido , String docIdentidad , String telefono , String correo ){
        // mostrar mensaje de registro exitoso
        limpiar() ;
    }
    
    private void btnRegistrarClienteMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnRegistrarClienteMouseReleased
        // TODO add your handling code here:
        String nombres = txtNombres.getText() ;
        String apellidos = txtApellidos.getText() ;
        String docIdentidad = txtDocIdentidad.getText() ;
        String telefono = txtTelefono.getText() ;
        String correo = txtCorreo.getText() ;
        registrar( nombres , apellidos , docIdentidad , telefono , correo ) ;
    }//GEN-LAST:event_btnRegistrarClienteMouseReleased

    private void btnLimpiarRegClienteMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnLimpiarRegClienteMouseReleased
        // TODO add your handling code here:
        limpiar() ;
    }//GEN-LAST:event_btnLimpiarRegClienteMouseReleased

    private void btnCancelarRegClienteMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCancelarRegClienteMouseReleased
        try {
            // TODO add your handling code here:
            this.finalize(); // <-------------- GG
            this.setVisible( false ) ;
        } catch (Throwable ex) {
            Logger.getLogger(Frm_RegistrarCliente.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnCancelarRegClienteMouseReleased

    private void limpiar(){
        txtNombres.setText( "" ) ;
        txtApellidos.setText( "" ) ;
        txtDocIdentidad.setText( "" ) ;
        txtTelefono.setText( "" ) ;
        txtCorreo.setText( "" ) ;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelarRegCliente;
    private javax.swing.JButton btnLimpiarRegCliente;
    private javax.swing.JButton btnRegistrarCliente;
    private javax.swing.JButton jButton3;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel lblApellido;
    private javax.swing.JLabel lblCorreo;
    private javax.swing.JLabel lblDocIdentidad;
    private javax.swing.JLabel lblNombre;
    private javax.swing.JLabel lblTelefono;
    private javax.swing.JTextField txtApellidos;
    private javax.swing.JTextField txtCorreo;
    private javax.swing.JTextField txtDocIdentidad;
    private javax.swing.JTextField txtNombres;
    private javax.swing.JTextField txtTelefono;
    // End of variables declaration//GEN-END:variables
}
